Skip to content

Add option to install context-lens#41

Open
webwarrior-ws wants to merge 1 commit into
tarsgate:masterfrom
webwarrior-ws:context-lens-squashed
Open

Add option to install context-lens#41
webwarrior-ws wants to merge 1 commit into
tarsgate:masterfrom
webwarrior-ws:context-lens-squashed

Conversation

@webwarrior-ws
Copy link
Copy Markdown
Contributor

@webwarrior-ws webwarrior-ws commented May 12, 2026

Added a --context-lens (-c) flag, that installs context-lens after installing Pi, and creates a launcher script "cpi" for it.

context-lens is installed from git repository, with 2 patches applied:

  • Enable using PPQ.ai in Pi through MITM proxy.
  • When launching pi, add providers based on env. vars & auth.json.

Launcher script launches context-lens with pi argument. Context-lens sets up pi (creates temp pi directory with
modified settings), in particular to route its traffic through mitmproxy. Otherwise context-lens wouldn't be able to capture
requests. Launcher script can't use spi because pi argument is not an executable name but a switch that tells context-lens to perform mentioned pi setup.

Comment thread src/index.ts Outdated
Comment thread src/index.ts Outdated
Comment thread src/index.ts Outdated
Comment thread src/index.ts Outdated
Comment thread src/index.ts Outdated
@webwarrior-ws webwarrior-ws force-pushed the context-lens-squashed branch 2 times, most recently from 7c1db0e to 0f58eeb Compare May 12, 2026 13:19
Comment thread src/index.ts Outdated
Comment thread src/index.ts
Comment thread ReadMe.md
@webwarrior-ws webwarrior-ws force-pushed the context-lens-squashed branch from 0f58eeb to c0fd5d7 Compare May 13, 2026 08:20
Comment thread src/index.ts Outdated
@webwarrior-ws webwarrior-ws force-pushed the context-lens-squashed branch 2 times, most recently from d24d478 to 14c0eaf Compare May 13, 2026 09:04
@knocte
Copy link
Copy Markdown
Contributor

knocte commented May 13, 2026

of what cpi launcher script does.

No, not clear enough. It has to mention why it can't use spi

@webwarrior-ws webwarrior-ws force-pushed the context-lens-squashed branch 2 times, most recently from bac7dd4 to f498b5c Compare May 13, 2026 09:12
@webwarrior-ws
Copy link
Copy Markdown
Contributor Author

of what cpi launcher script does.

No, not clear enough. It has to mention why it can't use spi

Is it good now?

@knocte
Copy link
Copy Markdown
Contributor

knocte commented May 13, 2026

mitmproxy is also installed to allow using PPQ.ai provider and other custom providers.

Outdated text?

pi tells context-lens to perform mentioned pi setup.

pi speaks to CL??

@webwarrior-ws webwarrior-ws force-pushed the context-lens-squashed branch from f498b5c to 0f6447d Compare May 13, 2026 12:08
@webwarrior-ws
Copy link
Copy Markdown
Contributor Author

mitmproxy is also installed to allow using PPQ.ai provider and other custom providers.

Outdated text?

Removed that paragraph.

pi tells context-lens to perform mentioned pi setup.

pi speaks to CL??

Rephrased. Should be clearer now.

Comment thread src/index.ts Outdated
@webwarrior-ws webwarrior-ws force-pushed the context-lens-squashed branch from 0f6447d to 8028e02 Compare May 13, 2026 12:45
@knocte
Copy link
Copy Markdown
Contributor

knocte commented May 14, 2026

It sets up pi (creates temp pi directory with modified settings),

Is "It" the launcher? or context-lens?

@webwarrior-ws webwarrior-ws force-pushed the context-lens-squashed branch from 8028e02 to 4f7a624 Compare May 18, 2026 08:47
@webwarrior-ws
Copy link
Copy Markdown
Contributor Author

It sets up pi (creates temp pi directory with modified settings),

Is "It" the launcher? or context-lens?

Context-lens. Clarified this paragraph in commit message and PR description.

Added a --context-lens (-c) flag, that installs context-lens
after installing Pi, and creates a launcher script "cpi" for it.

context-lens is installed from git repository, with 2 patches
applied:
- Enable using PPQ.ai in Pi through MITM proxy.
- When launching pi, add providers based on env. vars &
  auth.json.

Launcher script launches context-lens with `pi` argument.
Context-lens sets up pi (creates temp pi directory with
modified settings), in particular to route its traffic through
mitmproxy. Otherwise context-lens wouldn't be able to capture
requests. Launcher script can't use `spi` because `pi` argument
is not an executable name but a switch that tells context-lens
to perform mentioned pi setup.
@webwarrior-ws webwarrior-ws force-pushed the context-lens-squashed branch from f43c248 to 60d1a70 Compare May 20, 2026 10:40
@knocte
Copy link
Copy Markdown
Contributor

knocte commented May 21, 2026

Tried this today:

Building context-lens...

> context-lens@0.8.0 prepare
> git config core.hooksPath .githooks


added 29 packages, and audited 30 packages in 30s

8 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

> context-lens@0.8.0 build
> pnpm run generate:version && pnpm run generate:types && tsc

sh: pnpm: command not found
Error: Error: command 'npm' failed (exit code 127)
    at ChildProcess.<anonymous> (/Users/aidev/Work/skynot/dist/index.js:89:28)
    at ChildProcess.emit (node:events:509:20)
    at maybeClose (node:internal/child_process:1108:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)

So you're obviously missing to check if pnpm exists, and adding it as requirement in the same way you added mitmproxy.

Maybe try to build context-lens with npm instead of pnpm? Maybe it works and then we don't need to add a new dependency.

@webwarrior-ws
Copy link
Copy Markdown
Contributor Author

Maybe try to build context-lens with npm instead of pnpm? Maybe it works and then we don't need to add a new dependency.

Building without pnpm can be done, but it requires executing commands in "build" scripts but with npm instead of pnpm and npx for other executables such as tsc. Which can get out of sync if the "build" script changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants